const path = require('path');

module.exports = {
  transpileDependencies: [
    'vue',
    'uni-ui',
    '@dcloudio'
  ],
  configureWebpack: {
    resolve: {
      alias: {
        '@': path.resolve(__dirname, 'src')
      }
    },
    node: {
      __dirname: false,
      __filename: false
    }
  },
  chainWebpack: config => {
    // 添加一些可能解决兼容性问题的配置
    config.module
      .rule('js')
      .use('babel-loader')
      .tap(options => {
        // 修改babel-loader配置
        return {
          ...options,
          presets: [
            ['@babel/preset-env', {
              targets: {
                node: 'current'
              }
            }]
          ]
        };
      });
  }
};